package leetcode;

import java.util.ArrayList;
import java.util.List;

/**
 * 1431. 拥有最多糖果的孩子
 *
 */
public class T1131TheKidWithTheMostSweets {
    public List<Boolean> kidsWithCandies(int[] candies, int extraCandies) {
        List<Boolean> result = new ArrayList<>();
        int oldMax = -1;
        for (int i = 0; i < candies.length; i++) {
            if(candies[i]>oldMax){
                oldMax = candies[i];
            }
            candies[i] += extraCandies;
        }
        for (int i = 0; i < candies.length; i++) {
            if(candies[i]>=oldMax){
                result.add(Boolean.TRUE);
            }else{
                result.add(Boolean.FALSE);
            }
        }
        return result;
    }
}
